#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QTimer>
#include <QLineEdit>
#include <vector>
#include <QComboBox>
#include <QLabel>
#include <QradioButton>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    Ui::Widget *ui;

    void onTimer_5ms();
    void onTimer_10ms();
    void onTimer_100ms();
    void Lamp_Status_Ctrl(QLineEdit* lamp, bool value);
    void Lamp_Pwm_Ctrl(QLineEdit* lamp, uint8_t pwd);
    void initUi();
    QString createOutSigalName(const uint8_t& value);
    QString createOutFaultName(const uint8_t& value);
    uint16_t getTextInputAsU16(QLineEdit* lineEdit);
    int16_t getTextInputAsInt16(QLineEdit* lineEdit);
    bool createIOValueFromComboBox(QComboBox* vomboBox);
    bool createDiagValueFromComboBox(QComboBox* vomboBox);

    QTimer*    timer;
    QTimer*    timer_5ms;
    QTimer*    timer_100ms;

    QComboBox*              itsUsageMode;
    QComboBox*              itsWeakupState;

    std::vector<QLineEdit*> itsDatTimeAndPosLamps;
    bool                    itsDayTimeLampSwitch = false;//内部变量，日行灯开关
    QComboBox*              itsDaytimeLampOnCmd;
    QComboBox*              itsDayTimeLampLcuUartcanCommunicationIssue;
    QComboBox*              itsDRL_LED_Issue;
    QLabel*                 itsFLDaytimeLampOnSt;
    QLabel*                 itsFLDaytimeLampFlt;

    std::vector<QLineEdit*> itsDlpModuls;
    QComboBox*              itsIO_LM3409_EN;
    QLineEdit*              its_DO_S32K_SL3409_PWM;
    QLineEdit*              its_motor_Angle;
    QComboBox*              itsPubProjectionAngleAdjstReq;

    std::vector<QLineEdit*> itsHiBeam;
    QComboBox*              itsHiBeamOnCmd;
    QComboBox*              itsAdpvHiBeamFctOnCmd;
    QComboBox*              itsHiBeamBuckChannelIssue;
    QComboBox*              itsHiBeamLedDevIssue;
    QComboBox*              itsHiBeamBuckOutputIssue;
    QLabel*                 itsLeHiBeamOnSt;
    QLabel*                 itsLeHiBeamFlt;

    std::vector<QLineEdit*> itsLeftFrontTurnLamps;
    bool                    itsLeftFrontTurnLampSwitch = false;//内部变量，转向灯开关
    QComboBox*              itsTL_EN;
    QComboBox*              itsTL_Flow;
    QComboBox*              itsTurnLampOccupySts;
    QComboBox*              itsLeFrntTurnLampLcuUartcanCommunicationIssue;
    QComboBox*              itsTL_SW_OutputIssue;
    QComboBox*              itsLeFrntTurnLampLedIssue;
    QLabel*                 itsLeFrntTurnLampOnSt;
    QLabel*                 itsLeFrntTurnLampFlt;

    std::vector<QLineEdit*> itsLoBeam;
    QComboBox*              itsLoBeamOnCmd;
    QComboBox*              itsLoBeamBuckChannelIssue;
    QComboBox*              itsLoBeamLedDevIssue;
    QComboBox*              itsLoBeamBuckOutputIssue;
    QComboBox*              itsLoBeamPowerSupplyIssue;
    QLabel*                 itsLeLoBeamOnSt;
    QLabel*                 itsLeLoBeamFlt;
    bool                    isLobeamEnable = false;

    std::vector<QLineEdit*> itsPO2_LED; //装饰灯

    bool                    itsPosLampSwitch = false;
    QComboBox*              itsFLPosnLampOnCmd;
    QComboBox*              itsFLPosnLampBriSet;
    QComboBox*              itsPW_SW_OutputIssue;
    QLabel*                 itsLeFrntPosnLampOnSt;
    QLabel*                 itsLeFrntPosnLampBri;
    QLabel*                 itsLeFrntPosnLampFlt;

    std::vector<QLineEdit*> itsStarrySkyLamps;
    bool                    itsStarrySkyLampSwitch = false;//内部变量，星空灯开关

    std::vector<QLineEdit*> itsCornerLamp;
    QComboBox*              itsAFSEna;
    QLineEdit*              its_VehicleSpeed;
    QLineEdit*              its_SteeringWheelAngle;
    QComboBox*              itsCL_SW_SwitchIssue;
    QLabel*                 itsLCU_FL_FLCornerLampOnSt;
    QLabel*                 itsLCU_FL_FLCornerLampFlt;

    QComboBox*              itsLoBeamEffectCtrlCmd;
    QComboBox*              itsLoBeamEffectSel;
    QComboBox*              itsLoBeamEffectModSet;
    QComboBox*              itsFrntRibbonLampEffectCtrlCmd ;
    QComboBox*              itsFrntRibbonLampEffectSel ;
    QComboBox*              itsFrntRibbonLampEffectModSet ;
    QLabel*                 itsFrntRibbonLampEffectShowSt;
    QLabel*                 itsFrntRibbonLampEffectSt;
    QLabel*                 itsLoBeamEffectShowSt;
    QLabel*                 itsLoBeamEffectSt;


private slots:
    void on_comboBox_currentIndexChanged(int index);
    void on_comboBox_45_currentIndexChanged(int index);
};
#endif // WIDGET_H
